<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta charset="utf-8" />
	<meta http-equiv="expires" content="0" />
	<meta name="language" content="de" />
	<meta name="viewport" content="user-scalable=no,width=device-width" />
	<title>Audi MMI</title>
	
	<!-- CSS -->
	<link rel="stylesheet" href="./Audi_MMI_Files/styles_basics.css" type="text/css">
	<link rel="stylesheet" href="./Audi_MMI_Files/styles_list_basics.css" type="text/css">
	<link rel="stylesheet" href="./Audi_MMI_Files/styles_list_conversations.css" type="text/css">
			
	<!-- JS -->
	<script type="text/javascript" src="./Audi_MMI_Files/controls_key_mappings.js"></script>
	<script type="text/javascript" src="./Audi_MMI_Files/controls_helpers.js"></script>
	<script type="text/javascript" src="./Audi_MMI_Files/controls_list_basics.js"></script>
	<script type="text/javascript" src="./Audi_MMI_Files/controls_list_softkeys_inbox.js"></script>
	<script type="text/javascript">
		var listContents;
		var isReading = 0;
		var currendIndex = 0;
		var entriesPerPage = 4;
		var funcName = 'createListEntryStringConversation';
		var isFirstPage = true;//weil ueber history.back zurück gegangen wird. -> nicht aus app heraus springen
	
		window.onload = function() {
			var index = sessionStorage.getItem('selectedIndexConversation');
			currendIndex = index != null ? parseInt(index) : 0;//beim zurueck springen zur liste: letztes aktives element selektieren
			sessionStorage.removeItem('selectedIndexConversation');
			sessionStorage.removeItem('selectedConversation');//dann daten wieder löschen
			listContents = JSON.parse(sessionStorage.getItem('conversations'));//daten laden
			
			injectListContents(funcName);
		}
		
		function recognitionSucceeded(result) {
			console.log("Voice recognition stopped!");
			text = result.hypotheses[0].utterance;
			console.log("Recognized '" + text + "' with confidence " + result.hypotheses[0].confidence);
			var searchTermSpan = document.getElementById('searchTerm');
			if (text.search(/antwort/i) != -1) {
				sessionStorage.setItem('selectedMail', JSON.stringify(resp[(currendPage * 4 + currendIndex)]));
				location.href = './MMI_Mail_Write.html';
			}
			if (text.search(/neu/i) != -1) {
				sessionStorage.removeItem('selectedMail');
				sessionStorage.setItem('selectedIndexMail', currendIndex);
				location.href = './MMI_List_Contacts.html';
			}
			if (text.search(/such/i) != -1) {
				location.href = './MMI_List_Search.html';
			}
			if (text.search(/vorles/i) != -1 || text.search(/lies/i) != -1 || text.search(/ließ/i) != -1) {
				rightTopSoftKey();
			}
			if (text.search(/stop/i) != -1) {
				rightTopSoftKey();
			}
		}
	</script>
</head>

<body onkeydown="navigationList(event)" onmousewheel="scroll(event)">
	<div id="mainScreenSubheadline">
		<div id="topPanel">
			<div id="softKeyLeftTop" class="softKey softKeyTop softKeyLeft">
				Neu
			</div>
			<span id="headline">Audicted</span>
			<div id="softKeyRightTop" class="softKey softKeyTop softKeyRight">
				Vorlesen
			</div>
		</div>
		<div id="contentPanel">
			<div id="subHeadline">
				Freunde
			</div>
			<div id="sliderSmall">
			</div>
			<div id="listContent">
				<div id="listItems">
				</div>
			</div>
		</div>
		<div id="bottomPanel">
			<div id="softKeyLeftBottom" class="softKey softKeyBottom softKeyLeft">
				Suchen
			</div>
			<div id="softKeyRightBottom" class="softKey softKeyBottom softKeyRight" style="color:gray">
				Einstellungen
			</div>
		</div>
		<div id="statusScreen">
		</div>
	</div>
</body>
</html>